/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package testgui3;


import javax.swing.JLabel;
import java.util.*;

/**
 *
 * @author Administrator
 */
public class Restaurant {
    
    private MoneyTimer moneytimer;
    private Table[] tableArray;
    private int numberOfTables;
    private String[] strArrayTableNames;
    
    public Restaurant(int tables, String[] strArray)
    {
        strArrayTableNames = strArray;
        numberOfTables = tables;
        tableArray = new Table[numberOfTables];
        moneytimer = new MoneyTimer(); 
        
        for(int i = 0; i < numberOfTables; i++)
        {
            tableArray[i] = new Table();
        }
        
        
    }
    
    public MoneyTimer getMoneyTimer()
    {
        return moneytimer;
    }
    
    private int getTableNumberOfTableName(String s)
    {
        for(int i = 0; i < numberOfTables; i++)
        {
            if(s.equals(strArrayTableNames[i]))
            {
                return i;
            }
            else
            {
                return -1;
            }
        }
        
        return -1;
    
    }
    
    public Table returnTableBelongsToJLabel(JLabel jLabel)
    {
        if(jLabel.getName().equals("table1"))
        {
            return tableArray[0]; 
        }
        
        return tableArray[0];
        
        //int num = getTableNumberOfTableName(jLabel.getName() );
        //return tableArray[num];
    }
    

}
